<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>用户注册</title>
<link rel="stylesheet" type="text/css" href="static/common/css/base.css">
<link rel="stylesheet" type="text/css" href="static/css/register.css">
<script src="static/common/js/jquery-1.9.1.min.js" type="text/javascript"></script>

</head>

<body>
<!--main s-->
<div class="main">
  <div class="formItem">
    <div class="inputItem">
      <label class="allLabel">用户名</label>
      <div class="allInputPar nameInputPar"><input class="allInput nameInput" type="text" name="name" placeholder="请输入用户名" autocomplete="off"></div>
    </div>
    <div class="inputItem">
      <label class="allLabel">密码</label>
      <div class="allInputPar passwordInputPar"><input class="allInput passwordInput" type="password" name="password" placeholder="请输入密码" autocomplete="off"></div>
    </div>
    <div class="inputItem">
        <button class="allBtn loginBtn" tppe="button">登 录</button>
        <button type="button" class="allBtn resetBtn">重 置</button>
        <a class="register" href="register.html">注册</a>
        <a class="forgotPassword" href="register.html">忘记密码</a>
    </div>
  </div>    
</div>
<!--main e-->

<script type="text/javascript" src="static/common/js/getUrl.js"></script>
<script type="text/javascript" src="static/js/index.js"></script>
<script type="text/javascript">
var nameInput = $('.nameInput'),//用户名
  passwordInput = $('.passwordInput'),//密码
  loginBtn = $('.loginBtn'),//登录
  resetBtn = $('.resetBtn');//重置

var HOST = 'http://127.0.0.1:3000/'; 

//登录
loginBtn.on('click', function () {
  $.ajax({
    type : 'get',
    url : HOST + 'loginJson?name=' + nameInput.val() + '&password=' + passwordInput.val(),
    dataType : 'json',
    success:function(data) {
      console.log(data);
      if (data.success) {
        console.log('ddd');
        window.location.href = 'http://127.0.0.1:3000/list';
      }
    },
    error:function(errMsg) {
      
    }
  })
})

//重置
resetBtn.on('click', function () {
  nameInput.val('');
  passwordInput.val('')
})
</script>
</body>
</html>
